#include "verttextdlg.h"

VertTextDlg::VertTextDlg(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	connect(ui.OkButton, SIGNAL(clicked()), this, SLOT(ok()));
	connect(ui.CancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}

VertTextDlg::~VertTextDlg()
{

}

//VertTextDlg::VertTextDlg(QWidget *parent = 0, int count, QString defname, QString defdesc)
//	: QDialog(parent)
//{
//	ui.setupUi(this);
//	
//}
void VertTextDlg::setVal(int count, QString defname, QString defdesc) {
	if (count<2) {
		ui.Name->setEnabled(false);
		ui.Name->setText(QString("N/A"));
		defdesc = defname;
		Name = defname;
	} else {
		ui.Name->setText(defname);
		Name = defname;
	}
	Desc = defdesc;
	ui.Description->setText(defdesc);
	Count = count;
}
QString VertTextDlg::getText1() {
	return Name;
}
QString VertTextDlg::getText2() {
	if (Count>1) {
		return Desc;
	}
	return QString();
}
void VertTextDlg::ok() {
	if (Count > 1) {
		Name = ui.Name->text();
		Desc = ui.Description->text();
	} else {
		Name = ui.Description->text();
	}
	accept();
}